<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateHousesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::dropIfExists('houses');
        Schema::create('houses', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->decimal('price',8,2)
                ->nullable()->comment('价格');
            $table->string('price_unit')->default('万')->comment('万，k');
            $table->string('remark')->nullable()->comment('备注');
            $table->string('village')->nullable()->comment('城区');
            $table->integer('size')->nullable()->comment('房屋大小');
            $table->integer('selltype')->default(2)->comment('2，3， 4  房屋类型 二手， 出租， 新房');

            $table->string('total_floors')->default('')->comment('总楼层');
            $table->string('detail_address')->default('')->comment('详细地址');
            $table->json('area')->nullable()->comment('地址');

            $table->string('internal_structure')->nullable()->comment('内部 三室2厅2卫');
            $table->string('landlord_id')->nullable()->comment('房东id');
            $table->integer('status')->default(1)->comment('状态 1未售卖，2 已售卖');
            $table->integer('user_id')->nullable()->comment('创建用户id');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('houses');
    }
}
